#pragma once

template<typename T>
class IManager
{
public:
	IManager<T>()
	{

	}

	virtual ~IManager<T>()
	{

	}

	void Register(const std::string& name, T* item) 
	{
		auto iter = m_map.find(name);

		if (iter != m_map.end())
		{
			std::cout << "Overwriting existing item '" << name << "' in IManager '" << typeid(T).name() << "'" << std::endl;
		}
		
		m_map[name] = item;
	}

	void Unregister(const std::string& name)
	{
		auto iter = m_map.find(name);

		if (iter == m_map.end())
		{
			std::cout << "Item '" << name << "' does not exist in '" << typeid(T).name() << "'" << std::endl;
		}
		else
		{
			m_map.erase(item);
		}
	}

	T* Get(const std::string& name) 
	{
		auto iter = m_map.find(name);

		if (iter != m_map.end())
		{
			return iter->second;
		}
		else
		{
			std::cout << "Item '" << name << "' does not exist in '" << typeid(T).name() << "'" << std::endl;
			return NULL;
		}
	}

	virtual void Load(const std::string& name) = 0;
	virtual void Unload(const std::string& name) = 0;

private:
	std::map<const std::string, T*>	m_map;
};

